package com.anjie.powerproject.repository;

import com.anjie.powerproject.entity.ItemInfo;
import com.anjie.powerproject.entity.Manager;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

public interface ManagerRepository extends JpaRepository<Manager,Integer> {

    @Query(nativeQuery = true,value = "select * from manager where manager_name = ?1 and manager_pwd = ?2")
    Manager findManagerByManagerNameAndManagerPwd(String managerName,String managerPwd);

    @Query(nativeQuery = true,value = "select * from manager where manager_name = ?1")
    Manager findManagerByManagerName(String managerName);

    @Modifying
    @Query("update Manager m set m.managerName = ?1,m.managerPwd = ?2,m.remark = ?3 where m.managerId = ?4")
    int updateManager(String managerName,String managerPwd,String remark,int managerId);
}
